from flask import Flask,request

app = Flask(__name__)

@app.route('/')
def hello_world():
    return '<h1>Hello World!</h1>'

@app.route('/index',methods = ['GET','POST'])
def index():
    # 在url地址中获取数据
    user = request.args.get('user')
    password = request.args.get('password')
    print(user,password)

    # 请求体中获取数据
    x = request.form.get('user')
    y = request.form.get('password')
    print(x, y)

    result = request.get_json()
    print(result)

    return result

if __name__ == '__main__':
    app.run(debug=True, threaded=True)